#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      mcorrea
#
# Created:     24/04/2012
# Copyright:   (c) mcorrea 2012
# Licence:     <your licence>
#-------------------------------------------------------------------------------

class Queue:
    def __init__(self, start=[]):
        self.queue = []
        for x in start:
            self.enqueue(x)

    def enqueue(self, x):
        self.queue = self.queue + [x]


    def dequeue(self):
        if not self.queue:
            return
        last = self.queue[0]
        del self.queue[0]
        return last

    def empty(self):
        return not self.queue

    def _len_(self):
        return len(self.queue)

    def __getattr__(self, name):
        return getattr(self.queue, name)


def main():
    q = Queue()
    q.enqueue(50)
    q.enqueue(2)
    q.enqueue(3)

    print q.dequeue()
    print q.dequeue()
    print q.dequeue()
    print q.dequeue()

    q.enqueue(6)
    q.enqueue(7)
    print q.dequeue()
    print q.dequeue()

if __name__ == '__main__':
    main()
